AddTechNote = {
		saveTechNote:function (){
			var addtechNoteProjectId = document.getElementById("addtechNoteProjectId").value;
			var reportDate = document.getElementById("addReportDate").value;
			var reporter = document.getElementById("addReporter").value;
			var briefDesc = document.getElementById("addBriefDesc").value;
			var detailDesc = document.getElementById("addDetailDesc").value;
			var type = document.getElementById("addType").value;
			var level = document.getElementById("addLevel").value;
			var doer = document.getElementById("addDoer").value;
			/*var state = document.getElementById("addState").value;
			var techDemon = document.getElementById("addTechDemon").value;
			var closetime = document.getElementById("addClosetime").value;
			
			reportDatex = reportDate.split("-");
			closetimex = closetime.split("-");
			var timeStart = new Date(reportDatex[0],reportDatex[1],reportDatex[2]);
			var timeEnd = new Date(closetimex[0],closetimex[1],closetimex[2]);
			if(timeStart >= timeEnd){
				PigossMsg.alert("报告时间必须小于完成时间！");
				return;
			}*/
			
			if(type == null||type == ''){
			   PigossMsg.alert("技术备忘录类型不能为空或者空格！");
			   return;
			}
			if(briefDesc == null || briefDesc == ''){
			   PigossMsg.alert("bug简述不能为空或者空格！");
			   return;
			}
			if(detailDesc == null || detailDesc == ''){
			   PigossMsg.alert("详细描述不能为空或者空格！");
			   return;
			}
			AjaxUtil.request({
				url : 'add_techNote.action',
				params : {addtechNoteProjectId:addtechNoteProjectId,reportDate:reportDate,reporter:reporter,briefDesc:briefDesc,detailDesc:detailDesc,type:type,
					level:level,doer:doer/*,state:state,techDemon:techDemon,closetime:closetime*/},
				success : function(responseText){
					RefreshTechNote.refresh();
				},
				failure : function(){
					PigossMsg.alert("添加失败!");
				}
			});
			imgCloseShow();
		    
		},
		//保存技术备忘录并发送邮件
		saveTechNoteAndSendEmail:function(){
			var addtechNoteProjectId = document.getElementById("addtechNoteProjectId").value;
			var reportDate = document.getElementById("addReportDate").value;
			var reporter = document.getElementById("addReporter").value;
			var briefDesc = document.getElementById("addBriefDesc").value;
			var detailDesc = document.getElementById("addDetailDesc").value;
			var type = document.getElementById("addType").value;
			var level = document.getElementById("addLevel").value;
			var doer = document.getElementById("addDoer").value;
			/*var state = document.getElementById("addState").value;
			var techDemon = document.getElementById("addTechDemon").value;
			var closetime = document.getElementById("addClosetime").value;
			
			reportDatex = reportDate.split("-");
			closetimex = closetime.split("-");
			var timeStart = new Date(reportDatex[0],reportDatex[1],reportDatex[2]);
			var timeEnd = new Date(closetimex[0],closetimex[1],closetimex[2]);
			if(timeStart > timeEnd){
				PigossMsg.alert("报告时间必须小于完成时间！");
				return;
			}*/
			
			if(type == null||type == ''){
			   PigossMsg.alert("技术备忘录类型不能为空或者空格！");
			   return;
			}
			if(briefDesc == null || briefDesc == ''){
			   PigossMsg.alert("bug简述不能为空或者空格！");
			   return;
			}
			if(detailDesc == null || detailDesc == ''){
			   PigossMsg.alert("详细描述不能为空或者空格！");
			   return;
			}
			AjaxUtil.request({
				url : 'add_techNote_and_sendEmail.action',
				params : {addtechNoteProjectId:addtechNoteProjectId,reportDate:reportDate,reporter:reporter,briefDesc:briefDesc,detailDesc:detailDesc,type:type,
					level:level,doer:doer/*,state:state,techDemon:techDemon,closetime:closetime*/},
				success : function(responseText){
					PigossMsg.alert("添加并发送邮件成功!");
					RefreshTechNote.refresh();
				},
				failure : function(){
					PigossMsg.alert("添加失败!");
				}
			});
			imgCloseShow();
			
		}
};

RefreshTechNote= {
	   refresh:function(){
	       document.getElementById("queryTechNoteByCondition").submit();
	   }
};

editTechNote = {
		//更新技术备忘录状态
		saveTechNoteState:function (id){
			
			var editTechNoteLevel = document.getElementById("editTechNoteLevel").value;
			var editTechNoteState = document.getElementById("editTechNoteState").value;
			var editTechDemon = document.getElementById("editTechDemon").value;
			var editTechCloseDate = document.getElementById("editTechCloseDate").value;
			
			AjaxUtil.request({
				url : 'edit_TechNote_State.action',
				params : {editTechNoteStateid:id,editTechNoteState:editTechNoteState,editTechNoteLevel:editTechNoteLevel,editTechDemon:editTechDemon,editTechCloseDate:editTechCloseDate},
				success : function(responseText){
					RefreshTechNote.refresh();
				},
				failure : function(){
					PigossMsg.alert("修改失败!");
				}
			});
			imgCloseShow();
		},
		//更新技术备忘录
		update_techNote:function(tid){
			var reportDate = document.getElementById("editReportDate").value;
			var reporter = document.getElementById("editReporter").value;
			var briefDesc = document.getElementById("editBriefDesc").value;
			var detailDesc = document.getElementById("editDetailDesc").value;
			var type = document.getElementById("editType").value;
			var level = document.getElementById("editLevel").value;
			var doer = document.getElementById("editDoer").value;
			var state = document.getElementById("editState").value;
			var techDemon = document.getElementById("editTechDemon").value;
			var closetime = document.getElementById("editClosetime").value;
			
			reportDatex = reportDate.split("-");
			closetimex = closetime.split("-");
			var timeStart = new Date(reportDatex[0],reportDatex[1],reportDatex[2]);
			var timeEnd = new Date(closetimex[0],closetimex[1],closetimex[2]);
			if(timeStart > timeEnd){
				PigossMsg.alert("开始时间必须小于结束时间！");
				return;
			}
			
			AjaxUtil.request({
				url : 'update_techNote.action',
				params : {id:tid,reportDate:reportDate,reporter:reporter,briefDesc:briefDesc,detailDesc:detailDesc,type:type,
					level:level,doer:doer,state:state,techDemon:techDemon,closetime:closetime},
				success : function(responseText){
					RefreshTechNote.refresh();
				},
				failure : function(){
					PigossMsg.alert("添加失败!");
				}
			});
			imgCloseShow();
		},
		del:function(tid){
			AjaxUtil.request({
				url : 'del_techNote.action',
				params : {id:tid},
				success : function(responseText){
					RefreshTechNote.refresh();
				},
				failure : function(){
					PigossMsg.alert("添加失败!");
				}
			});
		}
};